package com.qixiaobao.nondirect.settle.mapper;

import com.qixiaobao.nondirect.settle.domain.InsureFee;
import com.qixiaobao.nondirect.settle.domain.InsureFeeReceipt;
import com.qixiaobao.nondirect.settle.domain.dto.InsureFeeDTO;
import com.qixiaobao.nondirect.settle.domain.vo.InsureFeeChargeVO;
import com.qixiaobao.system.domain.dto.ChargeDTO;
import com.qixiaobao.system.domain.dto.CountDTO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @Description 保费结算  数据层
 * @Author yangxm
 * @Date 2025/6/27 16:16
 */
@Mapper
public interface InsureFeeMapper {


    /**
     * @Description 查询 待支付、已结算列表
     * @Author yangxm
     * @Date 2025/6/27 17:24
     * @param insureFeeDTO
     * @return java.util.List<com.qixiaobao.nondirect.domain.InsureFee>
     */
    List<InsureFee> selectInsureFeeList(InsureFeeDTO insureFeeDTO);

    /**
     * @Description 待支付、已结算 - 结算人数和费用总计统计
     * @Author yangxm
     * @Date 2025/6/30 13:36
     * @param insureFeeDTO
     * @return com.qixiaobao.nondirect.invoice.domain.domain.dto.CountDto
     */
    CountDTO selectInsureFeeTotal(InsureFeeDTO insureFeeDTO);

    /**
     * @Description 待支付、已结算 - 费用详情
     * @Author yangxm
     * @Date 2025/6/30 14:50
     * @param chargeDTO
     * @return java.util.List<com.qixiaobao.nondirect.invoice.domain.domain.Charge>
     */
    List<InsureFeeChargeVO> selectChargeListByInsureFeeId(ChargeDTO chargeDTO);

    /**
     * @Description 保存保费结算数据
     * @Author yangxm
     * @Date 2025/6/30 16:08
     * @param insureFee
     * @return int
     */
    int insertInsureFee(InsureFee insureFee);

    /**
     * @Description 修改保费归属期
     * @Author yangxm
     * @Date 2025/6/30 17:15
     * @param insureFeeDTO
     * @return int
     */
    int updateInsureFeeMonth(InsureFeeDTO insureFeeDTO);

    /**
     * @Description 修改备注
     * @Author yangxm
     * @Date 2025/7/1 10:38
     * @param insureFeeDTO
     * @return int
     */
    int updateRemark(InsureFeeDTO insureFeeDTO);

    /**
     * @Description 查询 银行回单id集合
     * @Author yangxm
     * @Date 2025/7/1 13:27
     * @param insureFeeDTO
     * @return java.util.List<java.lang.Long>
     */
    List<Long> selectInsureFeeReceiptIdList(InsureFeeDTO insureFeeDTO);

    /**
     * @Description 根据id查询回单信息（老数据）
     * @Author yangxm
     * @Date 2025/7/1 14:08
     * @param insureFeeId
     * @return java.util.List<com.qixiaobao.nondirect.domain.InsureFeeReceipt>
     */
    List<InsureFeeReceipt> selectInsureFeeReceiptListById(Long insureFeeId);

    /**
     * @Description 根据id，查询原先的预回票时间
     * @Author yangxm
     * @Date 2025/7/1 14:14
     * @param insureFeeId
     * @return com.qixiaobao.nondirect.domain.InsureFee
     */
    InsureFee selectOldInvoiceReturnDate(Long insureFeeId);

    /**
     * @Description 修改预回票时间
     * @Author yangxm
     * @Date 2025/7/1 14:15
     * @param insureFeeDTO
     * @return int
     */
    int updateInvoiceReturnDate(InsureFeeDTO insureFeeDTO);

    /**
     * @Description 根据保费id，查询回单凭证(主子表结构)
     * @Author yangxm
     * @Date 2025/7/2 8:49
     * @param insureFeeId
     * @return com.qixiaobao.nondirect.domain.InsureFee
     */
    InsureFee selectInsureFeeReceiptByInsureFeeId(Long insureFeeId);

    /**
     * @Description 根据保费ids, 计算增员人数汇总，减员人数汇总，实付保费总计
     * @Author yangxm
     * @Date 2025/7/4 16:25
     * @param insureFeeIdList
     * @return com.qixiaobao.nondirect.settle.domain.InsureFee
     */
    InsureFee insureFeeSummaryByIdList(List<Long> insureFeeIdList);

    /**
     * @Description 根据保费ids查询实际付款单位
     * @Author yangxm
     * @Date 2025/7/4 16:26
     * @param insureFeeIdList
     * @return java.util.List<java.lang.Long>
     */
    List<Long> getSignCompanyByInsureFeeIdList(List<Long> insureFeeIdList);
}
